import unittest

from com.yhzy.oa.oa_user import User


class OaUserTestCase(unittest.TestCase):

    @classmethod
    def setUpClass(cls) -> None:
        cls.user = User()

    def test_code(self):
        resp = self.user.getCode()
        self.assertIn("操作成功", resp.text)

    def test_login(self):

        codeResp = self.user.getCode()
        uuid = codeResp.json()["uuid"]

        admin = {"username": "admin", "password": "admin123", "uuid":uuid, "code": 9999}
        loginResp = self.user.login(admin)
        self.assertEqual("操作成功",loginResp.json()["msg"])


if __name__ == '__main__':
    unittest.main()